<template>
  <div id="build_active">
    <c-title :hide="false" :text="integral ? integral : '积分'"></c-title>
    <diyBackGround></diyBackGround>
    <div class="main">
      <div class="detailBox">
        <div class="integralBox">
          <div class="integral">-{{total}}</div>
          <div class="image">
            <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images%2Fintegral%2Fimage1.png" alt="" />
          </div>
        </div>
        <div class="integralTxt">当前创建活动所需要的{{integral ? integral : "积分"}}</div>
      </div>
      <div class="creatBox">
        <div class="title">当前拥有的{{integral ? integral : "积分"}}：{{credit1}}</div>
        <van-field v-model="activityName" label="活动名称：" placeholder="填写名称" />
        <van-field v-model="average" type="digit" label="每人赠送：" placeholder="填写数量" />
        <van-field v-model="personNumber" type="tel" label="赠送数量：" placeholder="填写人数" />
      </div>
      <div class="creatBtn">
        <div class="btn" @click="createActivity">
          确认创建
          <van-icon name="add-o" />
        </div>
      </div>
    </div>

    <div id="content" v-if="false">
      <ul class="need_active">
        <li>
          <h1>
            -{{ total }}<span>{{ integral ? integral : "积分" }}</span>
          </h1>
        </li>
        <li>当前创建活动所需要的{{ integral ? integral : "积分" }}</li>
      </ul>
      <ul class="active_info">
        <li>
          <span>当前{{ integral ? integral : "积分" }}：</span>
          <span>{{ credit1 }}</span>
        </li>
        <li>
          <span>活动名称：</span>
          <input v-model="activityName" type="text" placeholder="填写名称" />
        </li>
        <li>
          <span>每人赠送：</span>
          <input v-model="average" @keyup="average = average.replace(/[^\d]/g, '')" type="tel" placeholder="填写数量" />
        </li>
        <li>
          <span>赠送数量：</span>
          <input v-model="personNumber" @keyup="personNumber = personNumber.replace(/[^\d]/g, '')" type="tel" placeholder="填写人数" />
        </li>
      </ul>
      <div class="btn">
        <button type="button" @click="createActivity">确认创建</button>
      </div>
    </div>
  </div>
</template>
<script>
import Integral_generalization_controller from "./integral_generalization_controller";

export default Integral_generalization_controller;
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
#build_active {
  .main {
    padding: 0 0.625rem;
    margin-top: -5.125rem;
    padding-bottom: 1rem;

    .creatBtn {
      display: flex;
      justify-content: center;
      align-items: center;
      background: #fff;
      padding-bottom: 1rem;

      .btn {
        display: flex;
        align-items: center;
        padding: 0.4375rem 4.6875rem;
        background: var(--themeBaseColor);
        border-radius: 0.3125rem;
        margin: 0 auto;
        color: #fff;
        margin-top: 2rem;

        i {
          margin-left: 0.25rem;
        }
      }
    }

    .creatBox {
      margin-top: 0.5rem;
      background: #fff;
      border-radius: 0.625rem;
      padding: 1rem;

      ::v-deep .van-cell {
        padding-left: 0;
      }

      .title {
        font-size: 0.875rem;
        color: #666;
        margin-bottom: 1.5rem;
        text-align: left;
      }
    }

    .detailBox {
      padding: 1rem;
      background: #fff;
      border-radius: 0.625rem;

      .integralTxt {
        font-size: 0.75rem;
        color: #666;
        text-align: left;
      }

      .integralBox {
        display: flex;
        align-items: center;

        .image {
          width: 1rem;
          height: 1rem;

          img {
            width: 100%;
            height: 100%;
          }
        }

        .integral {
          font-size: 1.5rem;
          font-weight: bold;
          color: #333;
          margin-right: 0.25rem;
        }
      }
    }
  }

  #content {
    .need_active {
      background-color: #fff;
      margin-top: 0.625rem;
      padding: 0.625rem 0.875rem;
      text-align: left;

      li {
        line-height: 1.875rem;
        font-size: 14px;
        display: flex;

        span {
          font-size: 14px;
          font-weight: normal;
        }

        h1 {
          font-size: 24px;
        }
      }

      li:last-child {
        color: #8c8c8c;
      }
    }

    .active_info {
      background-color: #fff;
      padding-left: 0.875rem;
      margin-top: 0.625rem;

      li {
        height: 2.8125rem;
        line-height: 2.8125rem;
        padding-right: 0.875rem;
        border-bottom: solid 0.0625rem #ebebeb;
        display: flex;
        font-size: 16px;

        span:first-child {
          text-align: left;
          width: 7.75rem;
          white-space: nowrap;
          overflow: hidden;
        }

        span:last-child {
          width: 15.4375rem;
          text-align: left;
          font-size: 18px;
          color: #f15353;
        }

        input {
          width: 15.4375rem;
          border: none;
        }
      }

      li:last-child {
        border: none;
      }
    }

    .btn {
      margin-top: 1.25rem;

      button {
        color: #fff;
        width: 90%;
        height: 2.875rem;
        background-color: #f15353;
        border-radius: 0.375rem;
        font-size: 16px;
        border: none;
      }
    }
  }
}
</style>